/*
 * @Author: zxf 
 * @Date: 2017-09-04 14:40:52 
 * @Last Modified by: zhuxiaofang
 * @Last Modified time: 2017-11-18 17:47:56
 */
import {
    NEW_TAB
} from  '../mutation-types'

const state = {
    tableNum:0,
    curSeclected:0,
    proItem:'行程管理',
    newTab:'',
    tabList:[ {
            'title':'行程管理',
            'delShow':false,
            'show':false,
            'active':true,
            'id':+new Date(),
            'components': 'StrokeProDefault',
            'text': 'infor0'
        }
    ],
}

const mutations = {
    DEFAULT_STROKE_TAB(state){
        state.tabList=[ {
            'title':'行程管理',
            'delShow':false,
            'show':false,
            'active':true,
            'id':+new Date(),
            'components': 'StrokeProDefault',
            'text': 'infor0'
        }]
        state.curSeclected = 0;
        state.tableNum= 0;
    },
    NEW_STROKE_TAB(state,tableLabel){
        state.tableNum++;
        var name = '';
        // if(tableLabel == 'StrokeProNew'){
        //     name = '新建行程';
        // }else if(tableLabel == 'StrokeProMembers'){
        //     name = '成员名单';
        // }else if(tableLabel == 'StrokeProMembersNew'){
        //     name = '新建成员';
        // }else if(tableLabel == 'strokeProSchedule'){
        //     name = '日程安排';
        //      state.componentName = 'strokeProSchedule';
        // }else if(tableLabel == 'strokeProNoticeOutgroup'){
        //     name = '出团通知';
        // }else if(tableLabel == 'strokeProNoticeAnnounce'){
        //     name = '公告通知';
        // }
        var newTab = {
            'title':tableLabel.title,
            'delShow':true,
            'show':true,
            'active':true,
            'id':+new Date(),
            'components': tableLabel.components,
            'text': 'infor'+state.tableNum,
            'dataId':tableLabel.dataId,
            'dataSn':tableLabel.dataSn,
        };
        state.curSeclected = state.tableNum;

        state.tabList.push(newTab);
    },
    TOGGle_STROKE_COMPONENT_BTN(state,componentIndex){
        state.curSeclected = componentIndex;
    },
    DELETE_STROKE_BTN(state,index){
        state.tabList.splice(index, 1);
        state.curSeclected = 0;
        state.tableNum--;
    }
}

export default {
    state,
    mutations
}